package com.zsj.mysql.config;

import com.baomidou.mybatisplus.extension.parsers.ITableNameHandler;
import com.zsj.util.DateUtil;
import org.apache.ibatis.reflection.MetaObject;

/**
 * @Description:
 * @Author:
 * @Date:
 */

public class MyDynamicTableNameParser implements ITableNameHandler {

    @Override
    public String dynamicTableName(MetaObject metaObject, String sql, String tableName) {

        String currentMonth = DateUtil.getCurrentMonth();
        // 加上分表逻辑后缀
        return tableName + "_" + currentMonth;
    }

}
